package com.bucg.cjcloud.gb28181.sip.support.schedule;

import com.bucg.cjcloud.gb28181.common.service.DeviceMangeService;
import com.bucg.cjcloud.gb28181.controller.SipController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class ScheduleComponent {

    @Autowired
    SipController gbController;

    @Autowired
    DeviceMangeService deviceMangeService;

    @Scheduled(cron = "0/10 * * * * ? ")
    public void catalog() {
        deviceMangeService.getPlatforms().forEach(val -> {
            gbController.sendRequest("catalog", val.getDeviceId(), true);
        });
    }
}
